import storage from '../utils/storage'

export const put = async (xkey, xdata, xexpires = 1000 * 3600 * 24 * 7) => {
  const resp = await storage.save({
    key: xkey,
    data: xdata,
    expires: xexpires
  })
  return resp
}

export const get = async (xkey) => {
  const resp = await storage.load({
    key: xkey
  }).then(ret =>{
    return {
      status: 200,
      data: ret
    }
  }).catch(err => {
    return {
      status: 400,
      message: err.message
    }
  })
  return resp
}
